<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/9/11
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/include.jsp" %>
<html>
<head>
    <title>Title</title>
    <script src="js/allDemand.js"></script>
    <script src="components/multiselect/multiple-select.js"></script>

    <link href="components/multiselect/multiple-select.css?2017" rel="stylesheet">
    <style>
.form-control {
    margin:10px 0
}

    </style>


    <script>

        $(function () {
            $('#status').change(function () {
                console.log($(this).val());
            }).multipleSelect({
                width: '120px',
                placeholder: '状态'
            });
            $('#feedbackCity').change(function () {
                console.log($(this).val());
            }).multipleSelect({
                width: '120px',
                placeholder: '反馈城市'
            });
            $('#title').change(function () {
                console.log($(this).val());
            }).multipleSelect({
                width: '120px',
                placeholder: '标题'
            });

            laydate.render({
                elem: '#beginTime'
                , range: true
            });
            laydate.render({
                elem: '#finishBeginTime'
                , range: true
            });
        });
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox ">
                <div class="ibox-content">

                    <div class="jqGrid_wrapper">
                        <div class="ui-jqgrid " id="gbox_table_list_2" dir="ltr">
                            <div class="ui-jqgrid-view table-responsive" style="height: 100%" role="grid"
                                 id="gview_table_list_2"
                            >


                                <form role="form" class="form-inline" style="margin-bottom: 10px" id="searchForm"
                                      method="post" action="getAlldemand.html">

                                    <input type="hidden" id="myDem" value="${myDem}">
                                    <div class="form-group">
                                        <select onchange="changeStatus()" id="demandType"
                                                name="conditions['demandType']" class="form-control"
                                                required="" aria-required="true">
                                            <option value="0"
                                                    <c:if test="${pages.conditions.demandType == 0}">selected</c:if>>全部类型
                                            </option>
                                            <option value="1"
                                                    <c:if test="${pages.conditions.demandType == 1}">selected</c:if>>BUG
                                            </option>
                                            <%--<option value="4"--%>
                                                    <%--<c:if test="${pages.conditions.demandType == 4}">selected</c:if>>测试BUG--%>
                                            <%--</option>--%>
                                            <option value="2"
                                                    <c:if test="${pages.conditions.demandType == 2}">selected</c:if>>需求
                                            </option>
                                            <option value="3"
                                                    <c:if test="${pages.conditions.demandType == 3}">selected</c:if>>操作
                                            </option>
                                        </select>
                                        &nbsp;&nbsp;
                                        <c:if test="${demandType == 0}">
                                            <select id="isSuspend"
                                                    name="conditions['isSuspend']" class="form-control"
                                                    required="" aria-required="true">
                                                <option value="0"
                                                        <c:if test="${pages.conditions.isSuspend == 0}">selected</c:if>>
                                                    状态
                                                </option>
                                                <option value="1"
                                                        <c:if test="${pages.conditions.isSuspend == 1}">selected</c:if>>
                                                    已暂停
                                                </option>
                                                <option value="2"
                                                        <c:if test="${pages.conditions.isSuspend == 2}">selected</c:if>>
                                                    已驳回
                                                </option>
                                                <option value="3"
                                                        <c:if test="${pages.conditions.isSuspend == 3}">selected</c:if>>
                                                    已处理
                                                </option>
                                            </select>
                                        </c:if>
                                        <c:if test="${demandType == 1}">
                                            <select id="status" multiple="multiple"
                                                    name="conditions['status']"
                                                    required="" aria-required="true">
                                                <option value="1"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',1,') >= 0}">selected</c:if>>
                                                    待审核
                                                </option>
                                                <option value="2"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',2,') >= 0}">selected</c:if>>
                                                    已审核
                                                </option>
                                                <option value="3"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',3,') >= 0}">selected</c:if>>
                                                    处理中
                                                </option>
                                                <option value="4"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',4,') >= 0}">selected</c:if>>
                                                    已处理
                                                </option>
                                                <option value="6"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',6,') >= 0}">selected</c:if>>
                                                    已驳回
                                                </option>
                                                <option value="7"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',7,') >= 0}">selected</c:if>>
                                                    已暂停
                                                </option>
                                            </select>
                                        </c:if>
                                        <c:if test="${demandType == 2}">
                                            <select id="status" multiple="multiple" value="${pages.conditions.status}"
                                                    name="conditions['status']"
                                                    required="" aria-required="true">


                                                <option value="1"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',1,') >= 0}">selected</c:if>>
                                                    待审核
                                                </option>
                                                <option value="2"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',2,') >= 0}">selected</c:if>>
                                                    待设计
                                                </option>
                                                <option value="3"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',3,')>= 0}">selected</c:if>>
                                                    设计中
                                                </option>
                                                <option value="4"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',4,') >= 0}">selected</c:if>>
                                                    设计完成
                                                </option>
                                                <option value="5"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',5,') >= 0}">selected</c:if>>
                                                    评审中
                                                </option>
                                                <option value="6"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',6,') >= 0}">selected</c:if>>
                                                    分配中
                                                </option>
                                                <option value="7"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',7,') >= 0}">selected</c:if>>
                                                    审批中
                                                </option>
                                                <option value="8"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',8,') >= 0}">selected</c:if>>
                                                    待开发
                                                </option>
                                                <option value="9"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',9,') >= 0}">selected</c:if>>
                                                    开发中
                                                </option>
                                                <option value="10"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',10,') >= 0}">selected</c:if>>
                                                    待测试
                                                </option>
                                                <option value="11"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',11,') >= 0}">selected</c:if>>
                                                    测试中
                                                </option>
                                                <option value="12"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',12,') >= 0}">selected</c:if>>
                                                    已处理
                                                </option>
                                                <option value="13"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',13,') >= 0}">selected</c:if>>
                                                    已驳回
                                                </option>
                                                <option value="14"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',14,') >= 0}">selected</c:if>>
                                                    已暂停
                                                </option>
                                            </select>
                                        </c:if>
                                        <c:if test="${demandType == 3}">
                                            <select id="status" multiple="multiple" value="${pages.conditions.status}"
                                                    name="conditions['status']"
                                                    required="" aria-required="true">
                                                <option value="1"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',1,') >= 0}">selected</c:if>>
                                                    待处理
                                                </option>
                                                <option value="2"
                                                        <c:if test="${fn:indexOf(pages.conditions.status,',2,') >= 0}">selected</c:if>>
                                                    已处理
                                                </option>
                                            </select>
                                        </c:if>
                                        &nbsp;&nbsp;
                                        <input readonly name="conditions['beginTime']" size="20" id="beginTime"
                                               placeholder="录入时间" value="${pages.conditions.beginTime}" type="text"
                                               class="form-control">
                                        <input type="hidden" name="conditions['endTime']"
                                               value="${pages.conditions.endTime}" id="endTime">
                                        &nbsp;&nbsp;
                                        <input readonly id="finishBeginTime" placeholder="处理完成时间"
                                               name="conditions['finishBeginTime']" size="20"
                                               value="${pages.conditions.finishBeginTime}"
                                               type="text"
                                               class="form-control">
                                        <input type="hidden" name="conditions['finishEndTime']"
                                               value="${pages.conditions.finishEndTime}" id="finishEndTime">
                                        &nbsp;&nbsp;
                                        <input type="text" name="conditions['createName']" placeholder="录入人"
                                               value="${pages.conditions.createName}" size="8"
                                               id="createName" class="form-control">&nbsp;&nbsp;
                                        <input name="conditions['currentPrincipal']" id="currentPrincipal"
                                               placeholder="责任人"
                                               type="text" size="8" value="${pages.conditions.currentPrincipal}"
                                               class="form-control">&nbsp;&nbsp;&nbsp;
                                        <input name="conditions['joinName']" id="joinName" placeholder="参与人"
                                               type="text" size="8" value="${pages.conditions.joinName}"
                                               class="form-control">&nbsp;&nbsp;&nbsp;

                                        <select id="priority" name="conditions['priority']" class="form-control"
                                                >

                                                <option value="0">优先级</option>
                                                <option
                                                        <c:if test="${pages.conditions.priority == 1}">selected</c:if>
                                                        value="1">一级</option>
                                                <option
                                                        <c:if test="${pages.conditions.priority == 2}">selected</c:if>
                                                        value="2">二级</option>
                                                <option
                                                        <c:if test="${pages.conditions.priority == 3}">selected</c:if>
                                                        value="3">三级</option>
                                                <option
                                                        <c:if test="${pages.conditions.priority == 4}">selected</c:if>
                                                        value="4">四级</option>
                                                <option
                                                        <c:if test="${pages.conditions.priority == 5}">selected</c:if>
                                                        value="5">五级</option>
                                        </select>&nbsp;&nbsp;&nbsp;
                                        <select id="title" name="conditions['title']"
                                                multiple="multiple">
                                            <c:forEach items="${titleList}" var="title">

                                                <option
                                                        <c:if test="${fn:indexOf(pages.conditions.title,title.title) >= 0}">selected</c:if>
                                                        value="${title.title}">${title.title}</option>
                                            </c:forEach>
                                        </select>
                                        &nbsp;&nbsp;
                                        <input type="text" name="conditions['detail']" placeholder="问题描述"
                                               value="${pages.conditions.detail}" size="8"
                                               id="detail" class="form-control">&nbsp;&nbsp;
                                        <select id="demandProduct" name="conditions['demandProduct']"
                                                class="form-control"
                                                required="" aria-required="true">
                                            <option value="0"
                                                    <c:if test="${pages.conditions.demandProduct == 0}">selected</c:if>>
                                                问题产品
                                            </option>
                                            <c:forEach items="${productList}" var="product">
                                                <option
                                                        <c:if test="${pages.conditions.demandProduct == product.id}">selected</c:if>
                                                        value="${product.id}">${product.product_name}</option>
                                            </c:forEach>
                                        </select>

                                        <select name="conditions['feedbackCity']" multiple="multiple"
                                                id="feedbackCity">
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',南昌,') >= 0}">selected</c:if>
                                                    value="南昌">南昌
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',太原,') >= 0}">selected</c:if>
                                                    value="太原">太原
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',长沙,') >= 0}">selected</c:if>
                                                    value="长沙">长沙
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',郑州,') >= 0}">selected</c:if>
                                                    value="郑州">郑州
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',成都,') >= 0}">selected</c:if>
                                                    value="成都">成都
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',昆明,') >= 0}">selected</c:if>
                                                    value="昆明">昆明
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',石家庄,') >= 0}">selected</c:if>
                                                    value="石家庄">石家庄
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',武汉,') >= 0}">selected</c:if>
                                                    value="武汉">武汉
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',乌鲁木齐,') >= 0}">selected</c:if>
                                                    value="乌鲁木齐">乌鲁木齐
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',南京,') >= 0}">selected</c:if>
                                                    value="南京">南京
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',九江,') >= 0}">selected</c:if>
                                                    value="九江">九江
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',重庆,') >= 0}">selected</c:if>
                                                    value="重庆">重庆
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',泰州,') >= 0}">selected</c:if>
                                                    value="泰州">泰州
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',福州,') >= 0}">selected</c:if>
                                                    value="福州">福州
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',沈阳,') >= 0}">selected</c:if>
                                                    value="沈阳">沈阳
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',宜春,') >= 0}">selected</c:if>
                                                    value="宜春">宜春
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',集团,') >= 0}">selected</c:if>
                                                    value="集团">集团
                                            </option>
                                            <option
                                                    <c:if test="${fn:indexOf(pages.conditions.feedbackCity,',赤峰,') >= 0}">selected</c:if>
                                                    value="赤峰">赤峰
                                            </option>
                                        </select>


                                        &nbsp;&nbsp;
                                        <input name="conditions['feedbackName']" id="feedbackName"
                                               placeholder="反馈人"
                                               type="text" size="8" value="${pages.conditions.feedbackName}"
                                               class="form-control">&nbsp;&nbsp;
                                        <input name="conditions['demId']" id="demId"
                                               placeholder="编号"
                                               type="text" size="8" value="${pages.conditions.demId}"
                                               class="form-control">&nbsp;&nbsp;
                                        &nbsp;&nbsp;


                                        <button type="button" onclick="queryDemand()"
                                                class="btn btn-primary">搜索
                                        </button> &nbsp;&nbsp;&nbsp;
                                        <button type="button" id="exportBtn" class="btn btn-primary">导出</button>
                                        &nbsp;&nbsp;&nbsp;<button type="button" id="subBtn" class="btn btn-primary">
                                        问题提交
                                    </button>
                                        &nbsp;&nbsp;&nbsp;<input type="button" onclick="clearForms()" id="resetBut"
                                                                 value="重置" class="btn btn-reset">


                                        <div style="float: right;margin-right: 15px;margin-top: 25px">
                                            总记录：${pages.totalRecords}</div>
                                    </div>

                                </form>


                                <div class="ui-jqgrid-bdiv">
                                    <div style="position:relative;">
                                        <div></div>
                                        <table id="cusTable"
                                               class="ui-jqgrid-btable ui-common-table table table-bordered"
                                        >
                                            <tbody>
                                            <tr role="row" style="background: #F5F5F5;">
                                                <td>类型
                                                </td>
                                                <td>编号
                                                </td>
                                                <td>标题
                                                </td>
                                                <td>描述
                                                </td>
                                                <td>城市
                                                </td>
                                                <td>反馈人
                                                </td>

                                                <td>录入人
                                                </td>
                                                <td>录入时间
                                                </td>
                                                <td>
                                                    状态
                                                </td>
                                                <td>责任人
                                                </td>
                                                <td>开发人
                                                </td>
                                                <td>开始时间
                                                </td>
                                                </td>
                                                <td>
                                                    完成时间
                                                </td>
                                                <td>
                                                    耗时
                                                </td>
                                                <td>预计时间
                                                <td>操作
                                                </td>
                                            </tr>


                                            <c:forEach items="${pages.pageDatas}" var="demand">
                                                <tr role="row" tabindex="-1" id="${demand.id}"
                                                    statusText="${demand.status_text}" demandType="${demand.demandType}"
                                                    class="jqgrow ui-row-ltr">

                                                    <td>
                                                        <c:if test="${demand.demandType ==1}"><span
                                                                > <i class="fa fa-exclamation-triangle"
                                                                                          style="width:30px;text-align:center;color:#f74a13"></i>BUG</span></c:if>
                                                        <c:if test="${demand.demandType ==2}"><span
                                                                ><i class="fa fa-plus-circle"
                                                                                         style="width:30px;text-align:center;color:#f8ac59"></i>需求</span></c:if>
                                                        <c:if test="${demand.demandType ==3}"><span><i class="fa fa-cog"
                                                                                         style="width:30px;text-align:center;color:#1ab394"></i>操作</span></c:if>
                                                    </td>
                                                    <td>
                                                            ${demand.id}
                                                    </td>
                                                    <td>
                                                            ${demand.title}
                                                    </td>
                                                    <td>
                                                            ${fn:length(demand.detail) > 19 ? fn:substring(demand.detail,0,19) : demand.detail}

                                                    </td>
                                                    <td>
                                                            ${demand.feedback_city}

                                                    </td>
                                                    <td>
                                                                    ${fn:length(demand.feedback_name) > 10 ?'查看详细' : demand.feedback_name}
                                                    </td>
                                                    <td>
                                                            ${demand.create_name}
                                                    </td>
                                                    <td>
                                                        <fmt:parseDate value="${demand.create_time}"
                                                                       pattern="yyyy-MM-dd"
                                                                       var="receiveDate"></fmt:parseDate>
                                                        <fmt:formatDate value="${receiveDate}"
                                                                        pattern="yyyy-MM-dd"></fmt:formatDate>

                                                    </td>


                                                    <td>
                                                        <c:if test="${demand.is_suspend == 2}">已暂停</c:if>
                                                        <c:if test="${demand.is_suspend != 2}">
                                                            <c:if test="${demand.status_text == '已处理'}">
                                                                <font color="#20b2aa">${demand.status_text}</font>
                                                            </c:if>
                                                            <c:if test="${demand.status_text != '已处理'}">
                                                                ${demand.status_text}
                                                            </c:if>
                                                        </c:if>

                                                    </td>
                                                    <td>

                                                        <c:if test="${demand.status == 7}">总监</c:if>
                                                        <c:if test="${demand.status != 7 && demand.demandType!=3 }">${demand.current_principal}</c:if>
                                                        <c:if test="${demand.demandType == 3}">${demand.create_name}</c:if>
                                                    </td>
                                                    <td>
                                                        ${demand.programmer}
                                                    </td>
                                                    <td>
                                                        <fmt:parseDate value="${demand.begin_time}"
                                                                       pattern="yyyy-MM-dd"
                                                                       var="receiveDate"></fmt:parseDate>
                                                        <fmt:formatDate value="${receiveDate}"
                                                                        pattern="yyyy-MM-dd"></fmt:formatDate>

                                                    </td>
                                                    <td>
                                                        <fmt:parseDate value="${demand.finish_time}"
                                                                       pattern="yyyy-MM-dd"
                                                                       var="receiveDate"></fmt:parseDate>
                                                        <fmt:formatDate value="${receiveDate}"
                                                                        pattern="yyyy-MM-dd"></fmt:formatDate>

                                                    </td>
                                                    <td>
                                                      ${demand.diff}
                                                    </td>
                                                    <td>
                                                        <fmt:parseDate value="${demand.antipate_finish_time}"
                                                                       pattern="yyyy-MM-dd"
                                                                       var="receiveDate"></fmt:parseDate>
                                                        <fmt:formatDate value="${receiveDate}"
                                                                        pattern="yyyy-MM-dd"></fmt:formatDate>

                                                    </td>

                                                    <td>
                                                        <c:if test="${role.id <= 2 && user.id == 11 || user.id == 35 }">
                                                        <div class="btn-group">
                                                            <button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle" aria-expanded="false">操作 <span class="caret"></span>
                                                            </button>
                                                            <ul class="dropdown-menu">

                                                                    <li><a id="updBtn"
                                                                                  demandType="${demand.demandType}"
                                                                                  demId="${demand.id}" title="编辑"
                                                                                   type="button">
                                                                        编辑
                                                                    </a>
                                                                    </li>
                                                                    <li> <a id="delBtn"
                                                                                 demandType="${demand.demandType}"
                                                                                 demId="${demand.id}" title="删除"
                                                                                 type="button">删除
                                                                    </a>
                                                                    </li>







                                                                <li>
                                                                    <a id="searchBtn" demId="${demand.id}"
                                                                            title="查看" statusText="${demand.status_text}"
                                                                            demandType="${demand.demandType}"
                                                                             type="button">查看
                                                                    </a>

                                                                </li>
                                                            </ul>
                                                        </div>
                                                        </c:if>


                                                        <c:if test="${role.id > 2 && user.id != 11 && user.id != 35 }">
                                                            <a id="searchBtn" demId="${demand.id}"
                                                                    title="查看" statusText="${demand.status_text}"
                                                                    demandType="${demand.demandType}"
                                                                    class="handleicon" type="button"><i
                                                                    class="fa fa-search"></i>
                                                            </a>
                                                        </c:if>
                                                    </td>
                                                </tr>

                                            </c:forEach>


                                            </tbody>
                                        </table>
                                        <c:if test="${pages.totalPages>1 }">
                                            <page:pager pageSize="${pages.pageSize}" currPage="${pages.currPage}"
                                                        totalRecords="${pages.totalRecords}"
                                                        url="${pageContext.request.contextPath}/${action}?conditions['demandProduct']=${pages.conditions.demandProduct }
&conditions['createName']=${pages.conditions.createName }&conditions['status']=${pages.conditions.status }&conditions['beginTime']=${pages.conditions.beginTime1 }&conditions['joinName']=${pages.conditions.joinName }&conditions['currentPrincipal']=${pages.conditions.currentPrincipal }&conditions
['detail']=${pages.conditions.detail }&conditions['demandType']=${pages.conditions.demandType }&conditions['isSuspend']=${pages.conditions.isSuspend }&conditions
['feedbackCity']=${pages.conditions.feedbackCity }&conditions['feedbackName']=${pages.conditions.feedbackName }&conditions['title']=${pages.conditions.title }&conditions['finishBeginTime']=${pages.conditions.finishBeginTime1 }&conditions['finishEndTime']=${pages.conditions.finishEndTime }&conditions['endTime']=${pages.conditions.endTime }&conditions['demId']=${pages.conditions.demId }&bugType=${bugType}&conditions['priority']=${pages.conditions.priority }"/>

                                        </c:if>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>

<script>
     //enter搜索
    $('body').bind('keypress', function (event) {
       if (event.keyCode == "13") {
        queryDemand()
       }
      })

    //编辑按钮
    $("[id=updBtn]").click(function () {

        var title = "编辑提交";

        var action = "managerUpdDemand.html";

        //alert($(this).html());
        //alert($(this).attr('status'));
        //alert($(this).attr('demand_id'));
        //alert($(this).parent('tr').attr('custId'));
        index = layer.open({
            type: 2,
            title: title,
            skin: 'ilayui-layer-rm', //加上边框
            area: ['90%', '90%'], //宽高
            content: action + '?id=' + $(this).attr('demId') + "&demandType=" + $(this).attr('demandType'),
            end: function () {
                location.reload();
            }
        });
    });


    //删除
    $("[id=delBtn]").click(function () {
        var id = $(this).attr('demId');
        var demandType = $(this).attr('demandType');
        var title = "确定删除？";

        var obj = $(this);
        layer.msg(title, {
            time: 0 //不自动关闭
            , btn: ['确定', '取消']
            , yes: function (index) {


                var args = {
                    "opId": id,
                    "demandType": demandType
                }

                var url = "delAllDemand.html";

                //加载进度条
                layer.load(2, {
                    shade: [0.2, '#999999'] //0.1透明度的白色背景
                });
                $.post(url, args, function (data) {
                    data = jQuery.parseJSON(data);
                    //保存成功
                    if (data.code == 1) {
                        window.location.reload();
                        layer.closeAll('loading');
                    } else {
                        //失败
                        layer.alert(data.msg);
                        layer.closeAll('loading');
                    }
                });
                layer.close(index);

            }
        });
    });


    var index = 0;

    $("[id=operBtn]").click(function () {

        var title = "操作-处理";

        //alert($(this).html());
        //alert($(this).attr('status'));
        //alert($(this).attr('bug_id'));
        //alert($(this).parent('tr').attr('custId'));
        index = layer.open({
            type: 2,
            title: title,
            skin: 'ilayui-layer-rm', //加上边框
            area: ['30%', '50%'], //宽高
            content: 'goopOutBox.html?&id=' + $(this).attr('operationId')
//                end: function () {
//                    location.reload();
//                }
        });
    });


    $("#subBtn").click(function () {
        window.location = "goAddDemandSource.html";
    });


    $("[id=chbtn]").click(function () {

        var title = "暂停-处理";

        var isSuspend = $(this).attr('isSuspend');
        if (1 == isSuspend) {
            title = "开始-处理";
        }

        //alert($(this).html());
        //alert($(this).attr('status'));
        //alert($(this).attr('bug_id'));
        //alert($(this).parent('tr').attr('custId'));
        index = layer.open({
            type: 2,
            title: title,
            skin: 'ilayui-layer-rm', //加上边框
            area: ['500px', '300px'], //宽高
            content: 'goSuspendDemand.html?&id=' + $(this).attr('demId') + "&isSuspend=" + isSuspend
            + "&suspendId=" + $(this).attr('suspendId') + "&demandType=" + $(this).attr('demandType')
//                end: function () {
//                    location.reload();
//                }
        });
    });
    $("[id" +
        " = exportBtn]").click(function () {
        //可以点击一个按钮事件触发下面的代码进行导出
//        window.open("partExport.html","_blank");
        //或者可以提交表单
        $('#searchForm').attr('action', 'partExport.html');
        $('#searchForm').attr('target', '_blank');
        var beginTime = $("#beginTime").val();
        var finishBeginTime = $("#finishBeginTime").val();

        if ("" != beginTime) {
            $("#endTime").val(beginTime.substring(13));
            $("#beginTime").val(beginTime.substring(0, 10));

        }

        if ("" != finishBeginTime) {
            $("#finishEndTime").val(finishBeginTime.substring(13));
            $("#finishBeginTime").val(finishBeginTime.substring(0, 10));
        }
        $('#searchForm').submit();
        $('#searchForm').attr('target', '_self');
        $("#finishBeginTime").val(finishBeginTime);
        $("#beginTime").val(beginTime);
        ;
    });


</script>
</html>
